package com.supor.aiot.basket.api;

import com.alibaba.android.arouter.facade.annotation.Param;
import com.android.baseconfig.base.BaseApiResult;
import com.android.baseconfig.base.DataApiResult;
import com.supor.aiot.basket.bean.AddBasketBean;
import com.supor.aiot.basket.bean.BasketRequestBean;
import com.supor.aiot.basket.bean.BuyedIngredientsBean;
import com.supor.aiot.basket.bean.IngredientBean;
import com.supor.aiot.basket.bean.IngredientBuyBean;
import com.supor.aiot.basket.bean.IngredientDetailBean;
import com.supor.aiot.basket.bean.IngredientListBean;
import com.supor.aiot.basket.bean.MakeIngredientBean;
import com.supor.aiot.common.app.Constants;
import com.supor.aiot.basket.bean.BasketRequestBean;

import java.util.List;

import io.reactivex.rxjava3.core.Observable;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.HTTP;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * ---------------------------------------------------------------- <br>
 * Copyright (C) 2014-2020, by het, Shenzhen, All rights reserved.  <br>
 * ---------------------------------------------------------------- <br>
 * <p>
 * 描述: IpsService <br>
 * 作者: lei <br>
 * 日期: 2021/9/7 <br>
 */
public interface BasketService {

    /**
     * 分页查询菜篮子接口
     * @return BaseApiResult<String>
     */
    @GET(Constants.OSS_API + "foodTShoppingBasket/pageList")
    Observable<BaseApiResult<DataApiResult<List<IngredientBean>>>> requestBasket(@Query("page") int page, @Query("limit") int limit);


    /**
     * 添加到菜篮子接口
     * @return BaseApiResult<String>
     */
    @POST(Constants.OSS_API + "foodTShoppingBasket")
    Observable<BaseApiResult<String>> addIntoBasket(@Body AddBasketBean basketBean);

    /**
     * 删除单个菜篮子接口
     * @return BaseApiResult<String>
     */
    @POST(Constants.OSS_API + "foodTShoppingBasket/del/{id}")
    Observable<BaseApiResult<String>> deleteBasket(@Path("id") String ids);

    /**
     *  清除菜篮子接口
     * @return BaseApiResult<DataApiResult<List<IpsBean>>>>>
     */
    @GET(Constants.OSS_API + "foodTShoppingBasket/clean")
    Observable<BaseApiResult<String>> cleanBasket(@Body BasketRequestBean bean);

    /**
     *  查询清单食材接口
     * @return BaseApiResult<DataApiResult<List<IpsBean>>>>>
     */
    @GET(Constants.OSS_API + "foodTIngredientsList/findIngredientsList/{id}")
    Observable<BaseApiResult<BuyedIngredientsBean>> getIngredients(@Path("id") String ids);


    /**
     *  查询用户下清单列表
     * @return BaseApiResult<DataApiResult<List<IpsBean>>>>>
     */
    @GET(Constants.OSS_API + "foodTIngredientsList/page")
    Observable<BaseApiResult<DataApiResult<List<IngredientListBean>>>> checkIngredientList();

    /**
     * 生成食材清单
     * @return BaseApiResult<String>
     */
    @POST(Constants.OSS_API + "foodTIngredientsList/addIngredientsList/{id}")
    Observable<BaseApiResult<MakeIngredientBean>> makeIngredientList(@Path("id") String ingredientsID);

    /**
     *  查询食材清单明细
     * @return BaseApiResult<String>
     */
    @GET(Constants.OSS_API + "foodTIngredientsList/getInfoByBatchNo")
    Observable<BaseApiResult<IngredientDetailBean>> getIngredientDetail(@Query("listBatchno") String recipeID);


    /**
     *  根据菜篮子ID全部选中/不选中食材
     * @return BaseApiResult<String>
     */
    @GET(Constants.OSS_API + "foodTBasketIngredients/updIngredientsById/{id}")
    Observable<BaseApiResult<String>> selectAllIngredient(@Path("id") String recipeID,@Query("isSelect") int state);

    /**
     *  根据食材ID修改状态
     * @return BaseApiResult<String>
     */
    @GET(Constants.OSS_API + "foodTBasketIngredients/update/{id}")
    Observable<BaseApiResult<String>> changeIngredientState(@Path("id") String ingredientID,@Query("isSelect") int state);

    /**
     *  根据食材ID修改数量
     * @return BaseApiResult<String>
     */
    @GET(Constants.OSS_API + "foodTBasketIngredients/update/{id}")
    Observable<BaseApiResult<String>> changeIngredientState(@Path("id") String ingredientID,@Query("number") String number);

    /**
     *  根据单个食材ID修改购买状态
     * @return BaseApiResult<String>
     */
    @POST(Constants.OSS_API + "foodTIngredientsListDetail/update/{autoId}")
    Observable<BaseApiResult<String>> changeIngredientBuy(@Body IngredientBuyBean buyBean);


    /**
     *  根据清单ID修改购买状态
     * @return BaseApiResult<String>
     */
    @GET(Constants.OSS_API + "foodTIngredientsList/updIsbuyByBatchNo")
    Observable<BaseApiResult<String>> changeIngredientListBuy(@Query("listBatchno") String batchno ,@Query("isBuy") int state);


    /**
     *  删除清单
     * @return BaseApiResult<String>
     */
    @GET(Constants.OSS_API + "foodTIngredientsList/del/{id}")
    Observable<BaseApiResult<String>> deleteIngredientList(@Path("id") String ids);

    /**
     *  获取分享清单链接
     * @return BaseApiResult<String>
     */
    @GET(Constants.OSS_API + "foodTRecipe/getUrl")
    Observable<BaseApiResult<String>> getSharedIngredient(@Query("recipeId") String recipeId,@Query("type") int type);

}
